/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Interface;

import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/**
 *
 * @author cgzf
 */
public class Frame_Admin extends javax.swing.JFrame {

    /**
     * Creates new form Admin
     */
    public Frame_Admin() {
        initComponents();
    }

    public void disableAll() {
        pnlTest.setVisible(false);
        pnlStaff.setVisible(false);
        pnlStock.setVisible(false);
        pnlDoctor.setVisible(false);
        pnlTest.setVisible(false);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLayeredPane1 = new javax.swing.JLayeredPane();
        pnlTest = new javax.swing.JPanel();
        pnlStaff = new javax.swing.JPanel();
        pnlDoctor = new javax.swing.JPanel();
        pnlStock = new javax.swing.JPanel();
        pnlLogout = new javax.swing.JPanel();
        mnbAdmin = new javax.swing.JMenuBar();
        mnuTest = new javax.swing.JMenu();
        mnuStaff = new javax.swing.JMenu();
        mnuDoctor = new javax.swing.JMenu();
        mnuStock = new javax.swing.JMenu();
        mnuLogout = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        javax.swing.GroupLayout pnlTestLayout = new javax.swing.GroupLayout(pnlTest);
        pnlTest.setLayout(pnlTestLayout);
        pnlTestLayout.setHorizontalGroup(
            pnlTestLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 670, Short.MAX_VALUE)
        );
        pnlTestLayout.setVerticalGroup(
            pnlTestLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 410, Short.MAX_VALUE)
        );

        pnlTest.setBounds(300, 60, 670, 410);
        jLayeredPane1.add(pnlTest, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout pnlStaffLayout = new javax.swing.GroupLayout(pnlStaff);
        pnlStaff.setLayout(pnlStaffLayout);
        pnlStaffLayout.setHorizontalGroup(
            pnlStaffLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 940, Short.MAX_VALUE)
        );
        pnlStaffLayout.setVerticalGroup(
            pnlStaffLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 510, Short.MAX_VALUE)
        );

        pnlStaff.setBounds(120, 20, 940, 510);
        jLayeredPane1.add(pnlStaff, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout pnlDoctorLayout = new javax.swing.GroupLayout(pnlDoctor);
        pnlDoctor.setLayout(pnlDoctorLayout);
        pnlDoctorLayout.setHorizontalGroup(
            pnlDoctorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 890, Short.MAX_VALUE)
        );
        pnlDoctorLayout.setVerticalGroup(
            pnlDoctorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 600, Short.MAX_VALUE)
        );

        pnlDoctor.setBounds(0, 0, 890, 600);
        jLayeredPane1.add(pnlDoctor, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout pnlStockLayout = new javax.swing.GroupLayout(pnlStock);
        pnlStock.setLayout(pnlStockLayout);
        pnlStockLayout.setHorizontalGroup(
            pnlStockLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 940, Short.MAX_VALUE)
        );
        pnlStockLayout.setVerticalGroup(
            pnlStockLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 370, Short.MAX_VALUE)
        );

        pnlStock.setBounds(60, 140, 940, 370);
        jLayeredPane1.add(pnlStock, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout pnlLogoutLayout = new javax.swing.GroupLayout(pnlLogout);
        pnlLogout.setLayout(pnlLogoutLayout);
        pnlLogoutLayout.setHorizontalGroup(
            pnlLogoutLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 600, Short.MAX_VALUE)
        );
        pnlLogoutLayout.setVerticalGroup(
            pnlLogoutLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 350, Short.MAX_VALUE)
        );

        pnlLogout.setBounds(0, 0, 600, 350);
        jLayeredPane1.add(pnlLogout, javax.swing.JLayeredPane.DEFAULT_LAYER);

        mnbAdmin.setForeground(new java.awt.Color(204, 204, 204));
        mnbAdmin.setMargin(new java.awt.Insets(0, 300, 0, 0));

        mnuTest.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Picture/Test.png"))); // NOI18N
        mnuTest.setText("Test");
        mnuTest.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mnuTestMouseClicked(evt);
            }
        });
        mnuTest.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuTestActionPerformed(evt);
            }
        });
        mnbAdmin.add(mnuTest);

        mnuStaff.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Picture/Staff.png"))); // NOI18N
        mnuStaff.setText("Staff");
        mnuStaff.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mnuStaffMouseClicked(evt);
            }
        });
        mnbAdmin.add(mnuStaff);

        mnuDoctor.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Picture/Doctor.png"))); // NOI18N
        mnuDoctor.setText("Doctor");
        mnuDoctor.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mnuDoctorMouseClicked(evt);
            }
        });
        mnbAdmin.add(mnuDoctor);

        mnuStock.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Picture/Stock.png"))); // NOI18N
        mnuStock.setText("Stock");
        mnuStock.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mnuStockMouseClicked(evt);
            }
        });
        mnbAdmin.add(mnuStock);

        mnuLogout.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Picture/Logout.png"))); // NOI18N
        mnuLogout.setText("Logout");
        mnuLogout.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mnuLogoutMouseClicked(evt);
            }
        });
        mnbAdmin.add(mnuLogout);

        setJMenuBar(mnbAdmin);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLayeredPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1189, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLayeredPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 608, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void mnuTestActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuTestActionPerformed
    }//GEN-LAST:event_mnuTestActionPerformed

    private void mnuTestMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mnuTestMouseClicked
        try {
            disableAll();
            pnlTest.setVisible(true);
            Panel_ViewTest pvt = new Panel_ViewTest();
            Panel_History ph = new Panel_History();
            pnlTest.add(pvt);
            pvt.setSize(pnlTest.getSize());
            pvt.setVisible(true);
            ph.setVisible(true);
        } catch (Exception ex) {
        }
        // TODO add your handling code here:
    }//GEN-LAST:event_mnuTestMouseClicked

    private void mnuStaffMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mnuStaffMouseClicked
        try {
            disableAll();
            pnlStaff.setVisible(true);
            Panel_ViewStaff pvt = new Panel_ViewStaff();
            pnlStaff.add(pvt);
            pvt.setSize(pnlStaff.getSize());
            pvt.setVisible(true);
        } catch (SQLException ex) {
            Logger.getLogger(Frame_Admin.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_mnuStaffMouseClicked

    private void mnuDoctorMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mnuDoctorMouseClicked
        try {
            disableAll();
            pnlDoctor.setVisible(true);
            Panel_ViewDoctor pvt = new Panel_ViewDoctor();
            pnlDoctor.add(pvt);
            pvt.setSize(pnlDoctor.getSize());
            pvt.setVisible(true);
        } catch (Exception ex) {
        }// TODO add your handling code here:
    }//GEN-LAST:event_mnuDoctorMouseClicked

    private void mnuStockMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mnuStockMouseClicked
        try {
            disableAll();
            pnlStock.setVisible(true);
            Panel_ViewStock pvt = new Panel_ViewStock();
            pnlStock.add(pvt);
            pvt.setSize(pnlStock.getSize());
            pvt.setVisible(true);
        } catch (Exception ex) {
        }
        // TODO add your handling code here:
    }//GEN-LAST:event_mnuStockMouseClicked

    private void mnuLogoutMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mnuLogoutMouseClicked
        Frame_Login fl = new Frame_Login();
        this.setVisible(false);
        fl.setVisible(true);
    }//GEN-LAST:event_mnuLogoutMouseClicked

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Frame_Admin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Frame_Admin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Frame_Admin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Frame_Admin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Frame_Admin().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLayeredPane jLayeredPane1;
    private javax.swing.JMenuBar mnbAdmin;
    private javax.swing.JMenu mnuDoctor;
    private javax.swing.JMenu mnuLogout;
    private javax.swing.JMenu mnuStaff;
    private javax.swing.JMenu mnuStock;
    private javax.swing.JMenu mnuTest;
    private javax.swing.JPanel pnlDoctor;
    private javax.swing.JPanel pnlLogout;
    private javax.swing.JPanel pnlStaff;
    private javax.swing.JPanel pnlStock;
    private javax.swing.JPanel pnlTest;
    // End of variables declaration//GEN-END:variables
}
